package com.yohann.statistics.schedule;

import com.yohann.statistics.service.DailyService;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * <p>
 *
 * </p>
 *
 * @author Yohann
 * @since 2020/9/2
 */
@Component
public class ScheduledTask {
    @Autowired
    private DailyService dailyService;

    @Scheduled(cron = "0 0 1 * * ?")
    public void task(){
        String day = new DateTime().minusDays(1).toString("yyyy-MM-dd");
        dailyService.registerCount(day);
    }
}